import http from "../../../../class/Utils/Http"
import tips from "../../../../class/Utils/Tips"
var app =getApp()
Page({
    data: {
        currentTab: 0,
        testlistb: [1, 2, 3, 4, 5, 6, 7, 8],
        testlist: [1, 2, 3]
    },
    onShow: function () {
        var that = this
        var user = wx.getStorageSync('user');
        that.setData({
            user: user
        })
        http.reqload("/Mingpian/xiaoxi_list", {uid: user.userid}, function (res) {
console.log(res)
            if (res.list_friend.length > 0) {

                that.setData({
                    list: res.list_friend
                })
            } else {
                that.setData({
                    s: 2
                })
            }

        })

    },
    search: function (e) {
        var that = this
        var user = wx.getStorageSync('user');
        var title = e.detail.value;
        http.req("/Mingpian/sc_list", {userid: user.userid, title: title}, function (res) {
            console.log(res)
            if (res.code == '1') {
                that.setData({
                    s: 1,
                    list: res.data
                })
            } else {

                that.setData({
                    s: 3
                })
            }

        })
    },
    //滑动切换
    swiperTab: function (e) {
        var that = this;
        that.setData({
            currentTab: e.detail.current
        });
    },
    //点击切换
    changeTab: function (e) {
        var that = this;
        console.log(e)
        if (that.data.currentTab === e.currentTarget.dataset.current) {
            return false;
        } else {
            that.setData({
                currentTab: e.currentTarget.dataset.current
            })
        }
    },


})